/**
 * @description  : 许可证统计查询条件组件
 * @descriptionDetail : 许可证统计查询条件组件
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-12-05 13:59:23
 */
<template>
  <view class="pagebody">
    <view class="wrapTime">
      数据截止日期：{{ curDate }}
    </view>
	
    <view class="wrapCon">
      <view class="wrapCond">
        <view class="wrapBodyleft">
          <u-icon custom-prefix="csbi-icon" name="aim" size="30" :color="$theme.u_type_primary"></u-icon>
          <text style="margin-left: 20rpx;font-size: 30rpx;">
            当前条件
          </text>
        </view>
      </view>
      <view style="margin-top:20rpx;margin-bottom: 10rpx; width:100%;display: flex;flex-direction: row;align-items: center;">
        <view style="margin-right: 20rpx;">
          当前层级：
        </view>
        <u-tag mode="plain" type="info" v-if="regs" :text="regs" />
      </view>
    </view>
	
    <view class="wrapCon">
      <view class="wrapCond">
        <view class="wrapBodyleft">
          <u-icon custom-prefix="csbi-icon" name="clock" size="30" :color="$theme.u_type_primary"></u-icon>
          <text style="margin-left: 20rpx;font-size: 30rpx;">
            时间选择
          </text>
        </view>
        <!--        <u-button @click="resetTime" size="mini" plain type="primary" style="margin-left: inherit;margin-right: inherit;">
          重置
        </u-button> -->
      </view>
      <view class="wrapbot" @click="choiceTime">
        <view class="wrapbotTime">
          {{ timeOver }}
        </view>
        <u-icon name="calendar" size="30" :color="$theme.cm_form_right_icon_color"></u-icon>
      </view>
    </view>
    <view class="popup-submit-btns">
      <u-button class="u-btn" plain type="primary" @click="reset">
        全部重置
      </u-button>
      <u-button class="u-btn" type="primary" @click="confirm">
        确定
      </u-button>
    </view>
  </view>
</template>

<script>
export default{
  name:"LicSearchCom",
  props:{
    curDate:{
      type:String,
      default: "",
    },
    regs:{ // 前置条件
      type:String,
      default: undefined,
    },
  },
  data() {
    return {
      timeOver:'',
    }
  },
  watch:{
    curDate:{
      handler(newVal,oldVal){
        this.timeOver = newVal;
      },
      immediate: false,
    },
  },
  created() {
    if(this.curDate){
      this.timeOver = this.curDate;
    }
  },
  methods:{
    // resetTime(){
    //   this.timeOver = this.$u.timeFormat(Date.now(), "yyyy-mm-dd");
    // },ssssss
    reset(){
      this.timeOver = this.$u.timeFormat(Date.now(), "yyyy-mm-dd");
      this.$emit("search", {
        isReset:true,
        time: this.timeOver,
      });
    },
    confirm(){
      this.$emit("search", {
        isReset:false,
        time: this.timeOver,
      });
    },
    choiceTime(){
      this.$emit("choiceTime");
    },
  },
  
}
</script>

<style scoped lang="scss">
  .pagebody{
    background:#EEEEEE;
    height: 100vh;
  }
  .wrapTime{
    background: #E3F4FE;
    color:$u-type-primary;
	font-weight: 500;
    font-size: 32rpx;
    padding:$cm-conent-padding-column $cm-content-paddng-row;
  }
  .popup-submit-btns{
	padding:$cm-conent-padding-column $cm-content-paddng-row;
	position: fixed;
	bottom: 0;
  }
  .wrapBody{
    padding:20rpx 36rpx;
    display: flex;
    font-size:26rpx;
    justify-content: space-between;
    background: #fff;
  }
  .wrapCond{
    // padding:20rpx 36rpx;
    display: flex;
    font-size:26rpx;
    justify-content: space-between;
    background: #fff;
  }
  .wrapBodyleft{
    display: flex;
    align-items: center;
  }
  .wrapimg{
    width: 40rpx;
    height: 40rpx;
    margin-right:10rpx;
  }
  .wrapRImg{
    width: 36rpx;
    height: 36rpx;
    transform:rotate(-90deg);
  }
  .wrapCon{
    background: #ffffff;
    padding:20rpx 36rpx;
    margin-top: 20rpx;
  }
  .wrapbot{
    display: flex;
	flex-direction: row;
    justify-content: space-between;
    border:1px solid $cm-form-item-bottom-border-color;
    padding:16rpx 20rpx;
    border-radius: 6rpx;
    font-size:26rpx;
    width: 100%;
    margin-top: 20rpx;
  }
  .wrapbotTime{
    margin-right:20rpx;
	font-size: 30rpx;
  }
</style>